package cc.linker.steplink.crm.controller;

import cc.linker.steplink.crm.service.PersonalService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@Slf4j
@Controller
@RequestMapping("/personal")
public class PersonalController {

    @Autowired
    private PersonalService personalService;

    /**
     * 获取微信用户信息
     * @param openId 微信openID
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/getWxUserInfo", method = RequestMethod.POST)
    @ResponseBody
    public Map<String,String> getWxUserInfo(HttpServletRequest request) throws Exception {
        LOGGER.info("进入getWxUserInfo~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
        Map<String,String> customerInfoWx = personalService.getWxUserInfo(request);
        return customerInfoWx;
    }

    /**
     * 记录用户行为信息
     * @param openId 微信openID
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/userRecord", method = RequestMethod.POST)
    @ResponseBody
    public void userRecord(String openId) {

    }

}
